package com.nulldev.util.data.Arrays.sets;

import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;

public class EmptySet<E> implements Set<E> {

	@Override
	public int size() {
		return 0;
	}

	@Override
	public boolean isEmpty() {
		return true;
	}

	@Override
	public boolean contains(Object o) {
		return false;
	}

	@Override
	public Iterator<E> iterator() {
		return new Iterator<E>() {

			@Override
			public boolean hasNext() {
				return false;
			}

			@Override
			public E next() {
				return null;
			}
		};
	}

	@Override
	public Object[] toArray() {
		return new Object[0];
	}

	@Override
	public <T> T[] toArray(T[] a) {
		return a;
	}

	@Override
	public boolean add(E e) {
		return false;
	}

	@Override
	public boolean remove(Object o) {
		return false;
	}

	@Override
	public boolean containsAll(Collection<?> c) {
		return false;
	}

	@Override
	public boolean addAll(Collection<? extends E> c) {
		return false;
	}

	@Override
	public boolean retainAll(Collection<?> c) {
		return false;
	}

	@Override
	public boolean removeAll(Collection<?> c) {
		return false;
	}

	@Override
	public void clear() {
	}

	@Override
	public boolean equals(Object o) {
		return super.equals(o);
	}

	@Override
	public void forEach(Consumer<? super E> action) {
	}

	@Override
	public Stream<E> parallelStream() {
		return Stream.empty();
	}

	@Override
	public Stream<E> stream() {
		return Stream.empty();
	}

	@Override
	public boolean removeIf(Predicate<? super E> filter) {
		return false;
	}

	@Override
	public Spliterator<E> spliterator() {
		return new Spliterator<E>() {

			@Override
			public boolean tryAdvance(Consumer<? super E> action) {
				return false;
			}

			@Override
			public Spliterator<E> trySplit() {
				return this;
			}

			@Override
			public long estimateSize() {
				return 0;
			}

			@Override
			public int characteristics() {
				return 0;
			}

			@Override
			public void forEachRemaining(Consumer<? super E> action) {
			}

		};
	}

	public static <E> Set<E> make() {
		return new EmptySet<E>();
	}
}
